//
//  MemberCell.m
//  Shengzhuli
//
//  Created by FXGuo on 2018/1/27.
//  Copyright © 2018年 kamangkeji. All rights reserved.
//

#import "MemberCell.h"

@interface MemberCell()
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UILabel *desLab;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *nameWCons;
@property (weak, nonatomic) IBOutlet UIButton *selectBtn;

@end

@implementation MemberCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setModel:(MemberModel *)model
{
    _model = model;
    NSString *str = [NSString stringWithFormat:@"  %@  ",model.memberName];
    self.nameWCons.constant = [str sizeWithAttributes:@{NSFontAttributeName:Font(16)}].width;
    self.nameLab.text = str;
    self.desLab.text = model.memberRecommend;
    self.selectBtn.selected = model.isSelect;
}

- (IBAction)selectClick:(UIButton *)btn
{
    if (btn.isSelected) return;
    btn.selected = YES;
    self.model.isSelect = YES;
    if (self.selectBlock) {
        self.selectBlock(self.model);
    }
}

@end
